<?php
/*------------------------------------------------------------------------
# mod_PGMap - Google Map Module
# ------------------------------------------------------------------------
# author PixelTOP
# copyright Copyright (C) 2010 dev.pixeltop.com.br. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.dev.pixeltop.com.br
# Technical Support: dev.pixeltop.com.br/contact
-------------------------------------------------------------------------*/
// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' ); 
//class JElementGMapType extends JElement{
//	var $_name = "gmaptype";
//
//	function fetchElement  ( $name,  $value,  &$xmlElement,  $control_name){
//		$mapVariable = $xmlElement->get('var', 'map');
//		
//		$options[] = array('value' => 'ROADMAP', 'text' => 'Map');
//		$options[] = array('value' => 'SATELLITE', 'text' => 'Satellite');
//		$options[] = array('value' => 'HYBRID', 'text' => 'Hybrid');
//		$options[] = array('value' => 'TERRAIN', 'text' => 'Terrain');
//		$onchange = 'onchange="'.$mapVariable.'.setMapTypeId(eval(\'google.maps.MapTypeId.\' + this.options[this.selectedIndex].value))"';
//		return JHTML::_('select.genericlist', $options, 'params['.$name.']', $onchange,'value', 'text', $value);
//	}	
//}

class JFormFieldGMapType extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since	1.6
	 */
	public $type = 'gmaptype';

	/**
	 * Method to get the field input markup.
	 *
	 * @return	string	The field input markup.
	 * @since	1.6
	 */
	protected function getInput()
	{

		// Initialize JavaScript field attributes.
//		$onchange= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
		$mapVariable = isset($this->element['var']) ? $this->element['var']: 'map';
		$options[] = array('value' => 'ROADMAP', 'text' => 'Map');
		$options[] = array('value' => 'SATELLITE', 'text' => 'Satellite');
		$options[] = array('value' => 'HYBRID', 'text' => 'Hybrid');
		$options[] = array('value' => 'TERRAIN', 'text' => 'Terrain');
		$onchange = 'onchange="'.$mapVariable.'.setMapTypeId(eval(\'google.maps.MapTypeId.\' + this.options[this.selectedIndex].value))"';
		return JHTML::_('select.genericlist', $options, $this->name, $onchange ,'value', 'text', $this->value);
	}
}